package com.cvte.shop.config;

import com.cvte.shop.interceptor.UserGradeInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author DaiShubo
 * @version 1.0
 * @description 注册mvc拦截器和过滤器
 * @createTime 2020/7/27 8:02 下午
 * @since 1.7
 **/
@Configuration
public class WebMvcConfiguration extends WebMvcConfigurerAdapter {

    @Autowired
    private UserGradeInterceptor userGradeInterceptor;

    /*
     * 配置拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userGradeInterceptor).addPathPatterns("/user/**");
        super.addInterceptors(registry);
    }

}
